package org.oss.exception;

public class NestedException extends RuntimeException
{
  private static final long serialVersionUID = -568365966L;
  private Throwable throwable;

  private NestedException(Throwable t)
  {
    this.throwable = t;
  }

  public static RuntimeException wrap(Throwable t)
  {
    if (t instanceof RuntimeException)
      return ((RuntimeException)t);
    return new NestedException(t);
  }

  public Throwable getCause() {
    return this.throwable;
  }

  public void printStackTrace() {
    this.throwable.printStackTrace();
  }
}